<!DOCTYPE html>
<html>
<body>

<script src="jquery.min.js"
        type="text/javascript">
</script>
<script src="js.cookie.js"
        type="text/javascript">
</script>
<script>
    function post() {

        var $form = $('<form>', {
            action: url,
            method: 'post'
        });
        append($form, param);
        $form.appendTo('body').submit();
    }

    function append($form, map) {
        $.each(map, function (key, val) {
            if (val instanceof Array) {
                $.each(val, function (ind, sub_val) {
                    $('<input>').attr({
                        type: "hidden",
                        name: key,
                        value: sub_val
                    }).appendTo($form);
                });
            } else {
                $('<input>').attr({
                    type: "hidden",
                    name: key,
                    value: val
                }).appendTo($form);
            }
        });
    }

    function get() {
        var url_param = $.param(param);
        window.location.replace(url + '?' + url_param);
    }

    $(function () {
        // activate cookie manager.
        console.log(document.cookie);
        if (method === 'post') {
            post()
        } else {
            get()
        }
    });
</script>

</body>
</html>